﻿/********************************************************************************
** @ Date:2025/06/20
** @ Author: Gaojia
** @ Description: 组合场景基类
** @ Version:1.0.0
** @ Fun:
********************************************************************************/
#ifndef CBaseScene_H
#define CBaseScene_H
#include "CBase.h"
class CBaseScene : public CBase
{
	Q_OBJECT
public:
	enum ESceneType {
		enRootScene,
		enNodeScene,
		enPageScene
	};
	CBaseScene(QString sName, QObject* parent = nullptr);
	~CBaseScene();
	QVector<CBaseScene*> getChildren() 
	{ 
		QVector<CBaseScene*>vecBaseScene;
		for (int i = 0; i < m_pVecChildren.size(); i++)
		{
			CBaseScene* pBaseScene = (CBaseScene *)m_pVecChildren[i];
			vecBaseScene.push_back(pBaseScene);
		}
		return vecBaseScene;
	}
	void addChild(CBase* child)
	{
		CBaseScene *pBaseScene = (CBaseScene *)child;
		if (!pBaseScene) return;
		pBaseScene->m_pParent = this;
		m_pVecChildren.append(pBaseScene);
		if (pBaseScene->getType() == enRootScene || pBaseScene->getType() == enNodeScene || pBaseScene->getType() == enPageScene)
		{
			m_pItem->appendRow(pBaseScene->getItem());
		}
	}
	// 获取节点类型
	ESceneType getType() const { return m_eSceneType; }
protected:
	ESceneType m_eSceneType;             // 节点类型
};

#endif